package com.jumi.microservice.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jm.member.common.core.web.page.TableDataInfo;
import com.jumi.microservice.dto.reponse.FenXiaoReponse;
import com.jumi.microservice.dto.request.FenXiaoQueryRequest;
import com.jumi.microservice.service.IJmUserFenxiaoService;
import com.jumi.microservice.service.IOrderService;
import com.jumi.microservice.service.PageService;
import com.jumi.microservice.util.WrapperUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户收益表 前端控制器
 * </p>
 *
 * @author 要挑客户管理团队
 * @since 2020-07-14
 */
@RestController
@RequestMapping("/jm-user-fenxiao")
@Api(value = "用户收益",tags = {"用户收益接口"})
public class JmUserFenxiaoController {

    @Autowired
    IJmUserFenxiaoService fenxiaoService;

    IOrderService orderService;

    @PostMapping("/getFenXiaoDataInfo")
    @ApiOperation("用户收益分页数据")
    public TableDataInfo<FenXiaoReponse>  getFenXiaoDataInfo(FenXiaoQueryRequest request,
                                                             Integer size, Integer current) {
        Page page=new Page(current,size);
        QueryWrapper wrapper= WrapperUtil.getWrapper(null,request);
        wrapper.eq("is_del",0);
        wrapper.orderByDesc("id");
        page=fenxiaoService.getPage(page,wrapper);
        return PageService.getDataTableInfo(page);
    }

}
